package com.imooc.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.imooc.beans.Message;
import com.imooc.service.MaintainService;

public class addMessageServelt extends HttpServlet {
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		
		req.setCharacterEncoding("utf-8");
		String[] ids=req.getParameterValues("id");
		
		String command = (String) req.getParameter("command");
		String description = (String) req.getParameter("description");
		String content = (String) req.getParameter("content");
		
		Message message= new Message();
		message.setCommand(command);
		message.setDescription(description);
		message.setContent(content);
		
		
		MaintainService maintainService= new MaintainService();
		maintainService.addMessage(message);
		
		
		
		
		req.getRequestDispatcher("List.action").forward(req, resp);
		
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

		
		
		this.doGet(req, resp);
	}
	

}
